/**
 * 酚酞
 */
Fentai = Widget.extend({
	ctor:function(){
		this._super();
		this.init();
		this.setTag(TAG_FENTAI_BOTTLE);
	},
	init:function(){
		var hand = new Button(this, 8, TAG_RIGHT, "#hand_right.png", this.callback);
		hand.setPosition(cc.p(30,56));
		hand.setScale(0.7);
		hand.setVisible(false);
		var part = new Button(this, 11, TAG_RIGHT_PART, "#hand_right_part.png", this.callback);
		part.setPosition(cc.p(30,56));
		part.setScale(0.7);
		part.setVisible(false);
		
		//瓶身
		this.body = new Button(this, 10, TAG_FENTAI, "#xi_ping.png", this.callback);
		//胶头滴管
		var lid = new Button(this, 9, TAG_DI, "#drop_bottle2.png", this.callback,this);
		lid.setPosition(0,41);

		var label = new cc.LabelTTF("酚酞",gg.fontName,12);
		label.setPosition(23, 32);
		label.setColor(cc.color(0, 0, 0));
		this.setCascadeOpacityEnabled(true);
		this.body.addChild(label, 11);
	},
	loadPoint:function(){
		var point=new cc.Sprite("#wpoint.png");
		point.setScale(0.7);
		var move=cc.moveTo(0.6, cc.p(-144,-245));
		var fad2=cc.fadeOut(0);
		var seq=cc.sequence(move,fad2);
		point.runAction(seq);
		point.setPosition(cc.p(-144,-150));
		this.addChild(point);
	},
	load_di:function(p){
		var move=cc.moveTo(0.6, cc.p(30,145));
		var ber = cc.bezierBy(1.5,[cc.p(-100,70),cc.p(-100,70),cc.p(-145,-200)]);
		var seq = cc.sequence(move,ber,cc.delayTime(2));
		p.runAction(seq);
	},

	callback:function(p){
		var func=cc.callFunc(this.actionDone, this);		
		var hand=this.getChildByTag(TAG_RIGHT);
		var part=this.getChildByTag(TAG_RIGHT_PART);
		switch(p.getTag()){
		case TAG_DI:
			hand.setVisible(true);
			part.setVisible(true);
			var move=cc.moveTo(0.6, cc.p(0,130));
			var ber = cc.bezierBy(1.5,[cc.p(-100,70),cc.p(-100,70),cc.p(-145,-200)]);
			var seq = cc.sequence(move,ber,cc.callFunc(function() {
				this.schedule(this.loadPoint,0.5,1);
			}, this),cc.delayTime(1),cc.callFunc(function() {
				var zhui1=this.getParent().getChildByTag(TAG_ZHUI_BOTTLE).getChildByTag(TAG_ZHUIXINGPING1);
				zhui1.runAction(cc.fadeIn(2));
				var zhui=this.getParent().getChildByTag(TAG_ZHUI_BOTTLE).getChildByTag(TAG_ZHUIXINGPING);
				zhui.runAction(cc.fadeOut(2));
			}, this),cc.delayTime(1),cc.callFunc(function() {
				this.removeFromParent();
			}, this),func);
			p.runAction(seq);
			this.load_di(hand);
			this.load_di(part);
			break;
		case TAG_SPOON:

			break;
		}
	},
	actionDone:function(p){
		switch(p.getTag()){
		case TAG_DI:

			gg.flow.next();
			break;
		}
	},
});